
<div class="moduleTopNav">
	<?php $module->printAddLink($lang->get('add-users')); ?>
</div>

<table class="datatable">
	<thead>
		<tr>
			<td>&nbsp;</td>
			<td><?php $module->printSortLink($lang->get('uname'), 'uname'); ?></td>
			<td><?php $module->printSortLink($lang->get('name'), 'name_f'); ?></td>
			<td><?php $module->printSortLink($lang->get('email'), 'email'); ?></td>
			<td><?php $module->printSortLink($lang->get('group'), 'group_id'); ?></td>
			<td><?php $module->printSortLink($lang->get('language'), 'language'); ?></td>
			<td><?php $module->printSortLink($lang->get('time-modified'), 'time_modified'); ?></td>
			<td><?php $module->printSortLink($lang->get('time-added'), 'time_created'); ?></td>
			<td><?php $module->printSortLink($lang->get('time-lastlogin'), 'time_lastlogin'); ?></td>
		</tr>
	</thead>
	<tbody>
		<?php
		
		$structure = array('uname', 'email', 'name', 'group', 'language_id', 'time_modified', 'time_created', 'time_lastlogin');
		$module->setStructure($structure);
		
		$res = $module->queryData("SELECT * FROM ".$db->table('users'));
		
		if(mysql_num_rows($res)) {
			while($row = mysql_fetch_array($res)) {
				
				$group = $module->groups_get($row['group_id']);
				
				$data = array(	'id'				=> stripslashes($row['id'])
								,'uname'			=> stripslashes($row['uname'])
								,'name'				=> stripslashes($row['name_f']).' '.stripslashes($row['name_l'])
								,'email'			=> '<a href="mailto:'.stripslashes($row['email']).'">'.stripslashes($row['email']).'</a>'
								,'group'			=> '<a href="'.$cosa->system('base-url').'?m='.$m.'&s=groups&edit='.stripslashes($group['id']).'">'.stripslashes($group['name']).'</a>'
								,'language'			=> stripslashes($row['language_id'])
								,'time_modified'	=> $cosa->datetime($row['time_modified'])
								,'time_created'		=> $cosa->datetime($row['time_created'])
								,'time_lastlogin'	=> $cosa->datetime($row['time_lastlogin'])
								);
				$module->printTableRow($data);
				
			}
		} else {
			$module->printEmptyTableRow($lang->get('no-items-found'));
		}
		
		?>
	</tbody>
</table>
